//========================================根据页面尺寸定义html fontSize大小
(function (doc, win) {
  var docEl = doc.documentElement,
  resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
  recalc = function () {
    var clientWidth = docEl.clientWidth;
    var clientHeight= docEl.clientHeight;
    if (!clientWidth) return;
    var itemWidth=Number(import.meta.env.VITE_DESIGN_WIDTH), itemHeight=Number(import.meta.env.VITE_DESIGN_HEIGHT), compute;
    if(itemHeight>0){
      compute=clientHeight/itemHeight;
    }else if(itemWidth>0){
      compute=clientWidth/itemWidth;
    }else{
      compute=0;
    }
    if(compute>0){
      docEl.style.fontSize = 20 * compute + 'px';
    }
  };

  recalc();
  if (!doc.addEventListener) return;
  win.addEventListener(resizeEvt, recalc, false);
  doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);